home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Computer Select (Limited Edition)
/
Computer Select.iso
/
pcmag
/
v10n16
/
trypoint.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1991-06-08
|
1KB
|
50 lines
// TRYPOINT.CPP - Try Point and Pixel Classes
// Compile with Borland C++ 2.0
// Copyright (C) 1991 Ziff Davis Communications
// PC Magazine * Ray Duncan May 1991
#include <iostream.h>
#include "point.h"
main()
{
int tempX, tempY, tempColor; // scratch variables
double degrees;
PIXEL myPixel(0,0,0);
cout << "\nEnter X coordinate: "; // prompt for pixel
cin >> tempX; // location and color
cout << "Enter Y coordinate: ";
cin >> tempY;
cout << "Enter pixel color: ";
cin >> tempColor;
myPixel.setX(tempX); // set pixel value
myPixel.setY(tempY);
myPixel.setColor(tempColor);
cout << "\nEnter X translation: "; // prompt for pixel
cin >> tempX; // translation and
cout << "Enter Y translation: "; // rotation
cin >> tempY;
cout << "Enter rotation (deg): ";
cin >> degrees;
myPixel.translate(tempX, tempY); // now apply translation
myPixel.rotate(degrees); // and rotation factors
cout << "\nNew value of pixel: "; // display new pixel values
myPixel.display();
}